Parent process

In computing, a parent process is a process that has created one or more child processes.

Contents

Unix

In the operating system Unix, every process except process 0 (the swapper) is created when another process executes the fork() system call. The process that invoked fork is the parent process and the newly-created process is the child process. Every process (except process 0) has one parent process, but can have many child processes.

The operating system kernel identifies each process by its process identifier. Process 0 is a special process that is created when the system boots; after forking a child process (process 1), process 0 becomes the swapper process (sometimes also known as the "idle task"). Process 1, known as init, is the ancestor of every other process in the system.

Zombies and orphans

When a child process terminates execution, either by calling the exit system call, causing a fatal execution error, or receiving a terminating signal, an exit status is returned to the operating system. The parent process is informed of its child's termination through a SIGCHLD signal. A parent will typically retrieve its child's exit status by calling the wait system call. However, if a parent does not do so, the child process becomes a zombie process.

A process that remains running even though its parent process has finished is an orphan process. In a Unix-like operating system any orphaned processes will be automatically adopted by the special init system process.

Linux kernel

In the Linux kernel, in which there is a very slim difference between processes and POSIX threads, there are two kinds of parent processes, namely real parent and parent. Parent is the process that receives the SIGCHLD signal on child's termination, whereas real parent is the thread that actually created this child process in a multithreaded environment. For a normal process, both these two values are same, but for a POSIX thread which acts as a process, these two values may be different.[1]

References

  1. ^ http://sunnyeves.blogspot.com/2010/09/sneak-peek-into-linux-kernel-chapter-2.html

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.